<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>

    <style>
        .v-enter {
            opacity: 0;
            padding-left: 20%;
        }
        
        .v-enter-to {
            opacity: 1;
            padding-left: 0%;
        }
        
        .v-enter-active {
            transition: all 2s ease;
        }
        
        .my-enter {
            opacity: 0;
            padding-left: 50%;
        }
        
        .my-enter-to {
            opacity: 1;
            padding-left: 0%;
        }
        
        .my-enter-active {
            transition: all 2s ease;
        }
    </style>
</head>
<!-- 
需求：实现点击按钮出现元素和元素消失，不使用动画就很突兀，使用动画就会慢慢的出现消失
-->

<body>
    <div id="a">
        <input type="button" value="不使用动画出现a" @click='ametheds'>
        <transition>
            <p v-if='ifappear'>{{a}}</p>
        </transition>
        <input type="button" value="自定义v-前缀出现a" @click='amethedsb'>
        <transition name='my'>
            <p v-if='ifappearb '>{{b}}</p>
        </transition>

    </div>

    <script>
        var a = new Vue({
            el: '#a ',
            data: {
                a: "a",
                ifappear: false,
                b: "b",
                ifappearb: false
            },
            methods: {
                ametheds: function() {

                    this.ifappear = !this.ifappear;
                },
                amethedsb: function() {

                    this.ifappearb = !this.ifappearb;
                }
            }


        })
    </script>
</body>

</html>